load("@prelude//toolchains/android/tools:build_rules.bzl", "buck_java_binary", "buck_java_library")
load("@prelude//utils:source_listing.bzl", "source_listing")

oncall("android_devxx")

source_listing()

buck_java_library(
    name = "apk",
    srcs = glob(["*.java"]),
    visibility = [
        "PUBLIC",
    ],
    deps = [
        "prelude//toolchains/android/src/com/facebook/buck/android/apk/sdk:apk_builder",
        "prelude//toolchains/android/src/com/facebook/buck/android/zipalign:zipalign",
        "prelude//toolchains/android/src/com/facebook/buck/util/zip:zip",
        "prelude//toolchains/android/third-party:args4j",
        "prelude//toolchains/android/third-party:guava",
        "prelude//toolchains/android/third-party/aosp:apksig",
    ],
)

buck_java_binary(
    name = "apk_builder_binary",
    java_args_for_run_info = [
        "--add-opens=java.base/sun.security.pkcs=ALL-UNNAMED",
        "--add-opens=java.base/sun.security.x509=ALL-UNNAMED",
    ],
    main_class = "com.facebook.buck.android.apk.ApkBuilderExecutableMain",
    visibility = [
        "PUBLIC",
    ],
    deps = [
        ":apk",
    ],
)
